import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";

@Entity("charge_strategy", { schema: "frog_charge" })
export class ChargeStrategy {
  @PrimaryGeneratedColumn({ type: "int", name: "strategy_id", unsigned: true })
  strategyId: number;

  @Column("int", { name: "merchant_id", unsigned: true, default: () => "'0'" })
  merchantId: number;

  @Column("varchar", { name: "strategy_name", comment: "策略名", length: 30 })
  strategyName: string;

  @Column("tinyint", {
    name: "strategy_type",
    comment: "类型",
    default: () => "'0'",
  })
  strategyType: number;

  @Column("decimal", {
    name: "unit_price",
    comment: "单价",
    precision: 4,
    scale: 2,
    default: () => "'0.00'",
  })
  unitPrice: string;

  @Column("float", {
    name: "settle_unit",
    comment: "最小计费单位",
    unsigned: true,
    precision: 12,
    default: () => "'0'",
  })
  settleUnit: number;

  @Column("smallint", {
    name: "max_power",
    comment: "最大功率",
    unsigned: true,
    default: () => "'0'",
  })
  maxPower: number;

  @Column("smallint", {
    name: "min_power",
    comment: "最小功率",
    unsigned: true,
    default: () => "'0'",
  })
  minPower: number;

  @Column("decimal", {
    name: "card_charge_amount",
    comment: "刷卡预付费",
    precision: 5,
    scale: 2,
    default: () => "'0.00'",
  })
  cardChargeAmount: string;

  @Column("varchar", { name: "remark", comment: "备注", length: 100 })
  remark: string;

  @Column("json", { name: "rules", nullable: true, comment: "费率规则" })
  rules: object | null;

  @Column("json", { name: "options", nullable: true, comment: "选项" })
  options: object | null;

  @Column("int", {
    name: "update_time",
    comment: "更新",
    unsigned: true,
    default: () => "'0'",
  })
  updateTime: number;

  @Column("int", {
    name: "create_time",
    comment: "创建时间",
    unsigned: true,
    default: () => "'0'",
  })
  createTime: number;
}
